package com.lz.stock.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author 廉壮
 * @version 1.0
 */
@RestController
@RequestMapping("/stock")
public class StockController {

    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/test")
    public String test(){

        return "stock success";
    }




    @GetMapping("test1")
    public String findGoods(){
        //通过服务id调用服务提供者
        String message = restTemplate.getForObject("http://order-service/order/test", String.class);
        return message;
    }

}
